package com.qianmi.cloud.app;

import cn.hutool.core.bean.BeanUtil;
import com.qianmi.cloud.api.UserQueryProvider;
import com.qianmi.cloud.bean.SysUser;
import com.qianmi.cloud.mapper.SysUserRepository;
import com.qianmi.cloud.respone.SysUserResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description
 * @Date: 1/18/22 16:06
 * @Created by xiaocai
 */
@RestController
public class UserQueryProviderImpl implements UserQueryProvider {

    @Autowired
    private SysUserRepository sysUserRepository;

    @Override
    public SysUserResponse loadUserByUsername(String username) {
        SysUser sysUser = sysUserRepository.findByUsername(username);
        return BeanUtil.copyProperties(sysUser, SysUserResponse.class);
    }
}
